package com.klanpaia.sos.neko.background1;

import org.andengine.opengl.font.Font;
import org.andengine.opengl.font.FontFactory;
import org.andengine.opengl.texture.TextureOptions;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.texture.region.TiledTextureRegion;
import org.andengine.ui.activity.BaseGameActivity;

import android.graphics.Color;
import android.graphics.Typeface;

public class ImagemLoad  {

	private BitmapTextureAtlas atlas;
	private Font mFont;
	
	/**
	 * @return the mFont
	 */
	public Font getmFont() {
		return mFont;
	}

	/**
	 * @param mFont the mFont to set
	 */
	public void setmFont(Font mFont) {
		this.mFont = mFont;
	}

	private TiledTextureRegion tAranha, tAtaque, tHeroi, tDirecionalA, tBotaoA;
	/**
	 * @return the tAtaque
	 */
	public TiledTextureRegion gettAtaque() {
		return tAtaque;
	}

	/**
	 * @param tAtaque the tAtaque to set
	 */
	public void settAtaque(TiledTextureRegion tAtaque) {
		this.tAtaque = tAtaque;
	}

	private ITextureRegion tAnalogRegion, tAnaTextureRegionBase;
	
	/**
	 * @return the tAnaTextureRegionBase
	 */
	public ITextureRegion gettAnaTextureRegionBase() {
		return tAnaTextureRegionBase;
	}

	/**
	 * @param tAnaTextureRegionBase the tAnaTextureRegionBase to set
	 */
	public void settAnaTextureRegionBase(TiledTextureRegion tAnaTextureRegionBase) {
		this.tAnaTextureRegionBase = tAnaTextureRegionBase;
	}

	/**
	 * @return the tDirecionalA
	 */
	public TiledTextureRegion gettDirecionalA() {
		return tDirecionalA;
	}

	/**
	 * @param tDirecionalA the tDirecionalA to set
	 */
	public void settDirecionalA(TiledTextureRegion tDirecionalA) {
		this.tDirecionalA = tDirecionalA;
	}

	/**
	 * @return the tBotaoA
	 */
	public TiledTextureRegion gettBotaoA() {
		return tBotaoA;
	}

	/**
	 * @param tBotaoA the tBotaoA to set
	 */
	public void settBotaoA(TiledTextureRegion tBotaoA) {
		this.tBotaoA = tBotaoA;
	}

	/**
	 * @return the tAranha
	 */
	public TiledTextureRegion gettAranha() {
		return tAranha;
		
	}

	/**
	 * @param tAranha the tAranha to set
	 */
	public void settAranha(TiledTextureRegion tAranha) {
		this.tAranha = tAranha;
	}

	/**
	 * @return the tHeroi
	 */
	public TiledTextureRegion gettHeroi() {
		return tHeroi;
	}

	/**
	 * @param tHeroi the tHeroi to set
	 */
	public void settHeroi(TiledTextureRegion tHeroi) {
		this.tHeroi = tHeroi;
	}
	
	/**
	 * @return the tAnalogRegion
	 */
	public ITextureRegion gettAnalogRegion() {
		return tAnalogRegion;
	}

	/**
	 * @param tAnalogRegion the tAnalogRegion to set
	 */
	public void settAnalogRegion(TiledTextureRegion tAnalogRegion) {
		this.tAnalogRegion = tAnalogRegion;
	}
	
	
	public void carregarImagens(BaseGameActivity contexto) {	
		BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("Sprites/"); 
		atlas = new BitmapTextureAtlas(contexto.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR);
		
		
		mFont = FontFactory.create(contexto.getFontManager(), contexto.getTextureManager(), 256, 256, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 24,  true, Color.WHITE);
		
		tAranha =  BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.atlas, contexto, "aranha.png", 0, 0, 7, 1); // 64x32
		tHeroi =  BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(atlas, contexto, "player.png", 0, 32, 3, 3); // 64x32	
		
		tBotaoA =  BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.atlas, contexto, "botaoA.png", 300, 96, 1, 1); // 64x32
		//tBotaoB =  BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.atlas, contexto, "botaoB.png", 300, 192, 1, 1); // 64x32
		tAtaque =  BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.atlas, contexto, "uia.png", 300, 288, 1, 1); // 64x32

		tAnaTextureRegionBase =  BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.atlas, contexto, "onscreen_control_base.png", 0, 416, 1, 1); // 64x32
		tAnalogRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.atlas, contexto, "onscreen_control_knob.png", 428, 416, 1, 1);
		
		this.settAranha(tAranha);
		this.settHeroi(tHeroi);
		this.settBotaoA(tBotaoA);
		this.settAtaque(tAtaque);
		this.setmFont(mFont);
		
		mFont.load();
		atlas.load();
	}


	
}
